﻿using System;
using Team4Mock.DAO;
using System.Data;

namespace Team4Mock.Entity
{
    public class ServiceEntity
    {
        ServiceDAO sd=new ServiceDAO();
        private int serviceID;
        private string serviceName;
        private string serviceShortDes;
        private string subType;
        private int contactID;
        private string clientDescription;
        private string serviceAttendance;
        private string serviceStartExpected;
        private string serviceStartDate;
        private string serviceEndDate;
        private int serviceExtendable;
        private int serviceExtenYears;
        private int serviceExtenMonth;
        private string serviceFullDes;
        private string deptCode;
        private string serviceType;
        private string serviceDesDel;
        private string serviceContractCode;
        private string serviceContractValue;
        private int contractStagedPayment;
        private string referralProcess;
        private int serviceTimeLimited;
        private int serviceTimeLimitedYear;
        private int serviceTimeLimitedMonth;
        private int programID;
        private int isActive;

        public string Procedure { get; set; }
        public int ServiceID
        {
            get { return this.serviceID; }
            set
            {
                if (value == null)
                    throw new Exception("serviceID not allow nullvalue.");
                this.serviceID = value;
            }
        }
        public string ServiceName
        {
            get { return this.serviceName; }
            set { this.serviceName = value; }
        }
        public string ServiceShortDes
        {
            get { return this.serviceShortDes; }
            set { this.serviceShortDes = value; }
        }
        public string SubType
        {
            get { return this.subType; }
            set { this.subType = value; }
        }
        public int ContactID
        {
            get { return this.contactID; }
            set { this.contactID = value; }
        }
        public string ClientDescription
        {
            get { return this.clientDescription; }
            set { this.clientDescription = value; }
        }
        public string ServiceAttendance
        {
            get { return this.serviceAttendance; }
            set { this.serviceAttendance = value; }
        }
        public string ServiceStartExpected
        {
            get { return this.serviceStartExpected; }
            set { this.serviceStartExpected = value; }
        }
        public string ServiceStartDate
        {
            get { return this.serviceStartDate; }
            set { this.serviceStartDate = value; }
        }
        public string ServiceEndDate
        {
            get { return this.serviceEndDate; }
            set { this.serviceEndDate = value; }
        }
        public int ServiceExtendable
        {
            get { return this.serviceExtendable; }
            set { this.serviceExtendable = value; }
        }
        public int ServiceExtenYears
        {
            get { return this.serviceExtenYears; }
            set { this.serviceExtenYears = value; }
        }

        public int RefID { get; set; }
        public int ServiceExtenMonth
        {
            get { return this.serviceExtenMonth; }
            set { this.serviceExtenMonth = value; }
        }
        public string ServiceFullDes
        {
            get { return this.serviceFullDes; }
            set { this.serviceFullDes = value; }
        }
        public string DeptCode
        {
            get { return this.deptCode; }
            set { this.deptCode = value; }
        }
        public string ServiceType
        {
            get { return this.serviceType; }
            set { this.serviceType = value; }
        }
        public string ServiceDesDel
        {
            get { return this.serviceDesDel; }
            set { this.serviceDesDel = value; }
        }
        public string ServiceContractCode
        {
            get { return this.serviceContractCode; }
            set { this.serviceContractCode = value; }
        }
        public string ServiceContractValue
        {
            get { return this.serviceContractValue; }
            set { this.serviceContractValue = value; }
        }
        public int ContractStagedPayment
        {
            get { return this.contractStagedPayment; }
            set { this.contractStagedPayment = value; }
        }
        public string ReferralProcess
        {
            get { return this.referralProcess; }
            set { this.referralProcess = value; }
        }
        public int ServiceTimeLimited
        {
            get { return this.serviceTimeLimited; }
            set { this.serviceTimeLimited = value; }
        }
        public int ServiceTimeLimitedYear
        {
            get { return this.serviceTimeLimitedYear; }
            set { this.serviceTimeLimitedYear = value; }
        }
        public int ServiceTimeLimitedMonth
        {
            get { return this.serviceTimeLimitedMonth; }
            set { this.serviceTimeLimitedMonth = value; }
        }
        public int ProgramID
        {
            get { return this.programID; }
            set { this.programID = value; }
        }
        public int IsActive
        {
            get { return this.isActive; }
            set { this.isActive = value; }
        }
        public DataTable GetProgram()
        {
            return sd.GetProgram();
        }
        public DataTable Getdata()
        {
            return sd.GetData();
        }
        public DataTable GetdataTrue()
        {
            return sd.GetDataTrue();
        }
        public DataTable GetdataByID(ServiceEntity e)
        {
            return sd.GetdataByID(e.ServiceID);
        }
        public void DelRef(string pro,int id)
        {
            sd.DelServiceRef(id,pro);
        }
        public void InsertRef(ServiceEntity e)
        {
            sd.InsertRef(e.ServiceID,e.RefID,e.Procedure);
        }
        public DataTable GetRef(string pro)
        {
            return sd.GetRef(pro);
        }
        public DataTable GetOrg()
        {
            return sd.GetOrg();
        }
        public int GetID()
        {
            return sd.GetID();
        }
        public bool CheckName(ServiceEntity e)
        {
            if (sd.CheckName(e.ServiceName)==true)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        public DataTable GetRefByID(int id,string proc)
        {
            return sd.GetRefByID(id,proc);
        }
        public void Insert(ServiceEntity e)
        {
            sd.InsertService(e.ServiceName,e.ServiceShortDes,e.SubType,e.ContactID,e.ClientDescription,e.ServiceAttendance,e.ServiceStartExpected,e.ServiceStartDate,e.ServiceEndDate,e.ServiceExtendable,e.ServiceExtenYears,e.ServiceExtenMonth,e.ServiceFullDes,e.DeptCode,e.ServiceType,e.ServiceDesDel,e.ServiceContractCode,e.ServiceContractValue,e.ContractStagedPayment,e.ReferralProcess,e.ServiceTimeLimited,e.ServiceTimeLimitedYear,e.ServiceTimeLimitedMonth,e.ProgramID,e.IsActive);
        }
        public void Update(ServiceEntity e)
        {
            sd.UpdateService(e.ServiceName, e.ServiceShortDes, e.SubType, e.ContactID, e.ClientDescription, e.ServiceAttendance, e.ServiceStartExpected, e.ServiceStartDate, e.ServiceEndDate, e.ServiceExtendable, e.ServiceExtenYears, e.ServiceExtenMonth, e.ServiceFullDes, e.DeptCode, e.ServiceType, e.ServiceDesDel, e.ServiceContractCode, e.ServiceContractValue, e.ContractStagedPayment, e.ReferralProcess, e.ServiceTimeLimited, e.ServiceTimeLimitedYear, e.ServiceTimeLimitedMonth, e.ProgramID, e.IsActive,e.ServiceID);
        }
    }
}